package demo1;

import java.util.Arrays;

class shape{
    public void draw(){
        System.out.println("画图形!");
    }
}

class Rect extends shape{
    @Override
    public void draw() {
        System.out.println("矩形");
    }
}
class Crecle extends shape{
    @Override
    public void draw() {
        System.out.println("圆形");
    }
}

class Flower extends shape{
    @Override
    public void draw() {
        System.out.println("❀");
    }
}




public class Test {
    public static void drawShapes() {
        Rect rect = new Rect();
        Crecle crecle = new Crecle();
        Flower flower = new Flower();
        String[] shapes = {"crecle", "rect", "crecle", "rect", "flower"};

        for (String shape : shapes) {
            if (shape.equals("cycle")) {
                crecle.draw();
            } else if (shape.equals("rect")) {
                rect.draw();
            } else if (shape.equals("flower")) {
                flower.draw();
            }
        }
    }

    public static void drawShapes1() {
        Rect rect = new Rect();
        Crecle crecle = new Crecle();
        Flower flower = new Flower();
        shape shapes[] = {crecle,rect,crecle,rect,flower};

        for (shape shape : shapes) {
            shape.draw();
        }
    }



    public  static void drawMap(shape shape){
        shape.draw();
    }
    public static void main(String[] args) {
        drawShapes1();

//        Rect rect = new Rect();
//        Crecle crecle = new Crecle();
//        Flower flower = new Flower();
//
//       drawMap(rect);
//       drawMap(crecle);
//       drawMap(flower);
    }
}
